<?php

//error_reporting(0);

function __autoload($class_name) {
   require_once $class_name . '.class.php';
}

function beginsWith( $str, $sub ) {
  //return ( substr( $str, 0, strlen( $sub ) ) === $sub );
  return strpos($str, $sub) == 0;
}

function endsWith( $str, $sub ) {
  //return ( substr( $str, strlen( $str ) - strlen( $sub ) ) === $sub );
  return strpos($str, $sub) == strlen($str) - strlen($sub);
}

if (!endsWith($_SERVER['PHP_SELF'], 'rcon/login.php')) {
	$rcon = $_SESSION['rcon'];
	if (!$rcon) {
		header("Location: login.php"); /* Redirect browser */
		
		/* Make sure that code below does not get executed when we redirect. */
		exit;
	}
}

?>